const STORAGE_KEY = 'todos-vuejs'

export default {
  fetch: function() {
    return window.JSON.parse(window.localStorage.getItem(STORAGE_KEY) || '[]')
  },
  save: function(items) {
    window.localStorage.setItem(STORAGE_KEY, window.JSON.stringify(items))
  },
  saveByName: function(name,items) {
    window.localStorage.setItem(name, window.JSON.stringify(items))
  },
  getByName: function(name) {
    return window.JSON.parse(window.localStorage.getItem(name) || '[]')
  }
}
